package com.time.sky.controller;

import com.time.sky.entity.User;
import com.time.sky.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    UserMapper userMapper;

    @CrossOrigin//这个注解是解决跨域问题的
    @RequestMapping("/user/login")
    public User login(@RequestBody User user){
        User user1 = userMapper.login(user);
        if (user1!=null){
            return user1;
        }else {
            return null;
        }
    }


    @CrossOrigin//这个注解是解决跨域问题的
    @RequestMapping("/user/xiugaimima")
    public void xiugaimima(@RequestBody User user){
        userMapper.xiugaimima(user);
    }
}
